<template>
  <div class="dashboard-container">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="活动时间">
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
        </el-col>
        <el-col class="line" :span="2">-</el-col>
        <el-col :span="11">
          <el-time-picker placeholder="选择时间" v-model="form.date2" style="width: 100%;"></el-time-picker>
        </el-col>
      </el-form-item>
      <el-form-item label="优惠次数">
        <el-input v-model="form.count"></el-input>
      </el-form-item>

      <el-form-item label="优惠价格">
        <el-input v-model="form.price"></el-input>
      </el-form-item>

      <el-form-item label="最高优惠">
        <el-input v-model="form.maxPrice"></el-input>
      </el-form-item>
      
      <el-form-item>
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button>清空</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'activity',
  components: {  },
  data() {
    return {
      currentRole: 'adminDashboard',
      form: {
        count: 10,        // 优惠次数
        price: 0,         // 优惠价格
        maxPrice: 100,    // 最高优惠吗
        date1: '',        // 优惠起始时间
        date2: '',        // 优惠结束时间
      }
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  created() {
    if (!this.roles.includes('admin')) {
      this.currentRole = 'editorDashboard'
    }
  }
}
</script>
<style lang="scss" scoped>
  .dashboard-container {
    padding: 20px 10px
  }
  .btn-wrap{
    padding: 0 10px
  }
  .line{
    text-align: center
  }
</style>